package top.kaoshanji.p1ch04a;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * 代码清单 p1ch04a-02：Character类的使用示例
 * author kaoshanji
 * ^_^
 * create time 2025/1/14 17:16
 */
public class CharacterExample01 {

    private static final Logger logger = LogManager.getLogger(CharacterExample01.class);

    public static void main(String[] args) {
        logger.info("...代码清单 p1ch04a-02：Character类的使用示例...");

        String str = "你好";
        int codePoint = Character.codePointAt(str, 0);
        logger.info("...codePoint:{}...", codePoint);

        boolean isBmpCodePoint = Character.isBmpCodePoint(codePoint);
        logger.info("...isBmpCodePoint:{}...", isBmpCodePoint);

        int smpCodePoint = 0x12367;
        boolean isSupplementaryCodePoint = Character.isSupplementaryCodePoint(smpCodePoint);
        logger.info("...isSupplementaryCodePoint:{}...", isSupplementaryCodePoint);

        int charCount = Character.charCount(smpCodePoint);
        logger.info("...charCount:{}...", charCount);

        char high = Character.highSurrogate(smpCodePoint);
        // System.out.println("...high:" + high);
        logger.info("...high:{}...", high);

        char low = Character.lowSurrogate(smpCodePoint);
        logger.info("...low:{}...", low);


    }

}
